package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.entity.Comment;
import com.example.demo.mapper.Commentmapper1;
import com.example.demo.service.Commentsevice;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class Commentimpl implements Commentsevice {
    @Autowired
    Commentmapper1 commentmapper1;


    @Override
    public List<Comment> selectakaall(Wrapper<Comment> queryWrapper) {
        return null;
    }

    @Override
    public List<Comment> sle(Long bid) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("blog_id",bid);
        queryWrapper.eq("parent_comment_id","-1");
        queryWrapper.eq("rekey","-1");
        return commentmapper1.selectList(queryWrapper);
    }

    @Override
    public List<Comment> sl(Long prid) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("parent_comment_id",prid);
        return commentmapper1.selectList(queryWrapper);
    }

    @Override
    public int insert(Comment comment) {
        return commentmapper1.insert(comment);
    }
}
